#ifndef COMMUNICATECHANNEL_H
#define COMMUNICATECHANNEL_H

#include <QObject>


class CommunicateChannelPrivate;
class CommunicateChannel : public QObject
{
    Q_OBJECT
public:
    explicit CommunicateChannel(QObject *parent = nullptr);
    virtual ~CommunicateChannel();

public:

    /**
     * @brief bindAddr  绑定ip和端口
     * @param localIp   本地Ip
     * @param localPort 本地端口
     * @param groupIp   组播Ip
     * @param groupPort 组播端口
     * @return
     */
    bool bindAddr(char* localIp, int16_t localPort, char* groupIp, int16_t groupPort);

    int sendData(char* data, int dataLength);

    // 启动组播
    bool start();

    // 停止组播
    bool stop();

public:
    /**
     * @brief getSocketObj 获取SOCKET对象
     * @return
     */
    int64_t getSocketObj();

signals:
    // 将接收到的数据发送出去
    void emitRecvData(char* data, int dataLength);

private:
    CommunicateChannelPrivate* d;

};

#endif // COMMUNICATECHANNEL_H
